package com.mskj.zxmy.mapper;

import com.mskj.zxmy.entity.ProcessSigningTable;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;

@Mapper
public interface AttendanceMapper {
    void insertSignIn(ProcessSigningTable entity);

    // 更新工序基础表的签到人
    void updateProcessSignIn(@Param("processName") String processName, @Param("user") String user);

    // 更新签出时间和状态
    void updateSignOutTimeAndStatus(@Param("id") Integer id, @Param("signTime1") LocalDateTime signTime1, @Param("signStatus") String signStatus);

    // 查询工序基础表的签到人
    String getProcessSignIn(@Param("processName") String processName);

    // 查询当天该用户所有未签出的签到记录
    List<ProcessSigningTable> findTodayAllUnsignOutByUser(@Param("user") String user, @Param("today") LocalDate today);

    // 通过工序ID查工序名称
    String getProcessNameByProcessId(@Param("processId") Integer processId);


    ProcessSigningTable selectByUserProcessAndDate(String user, LocalDate today);

    @Select("select signIn from processBasicTables where processName =#{processName}")
    String getprocessBasicTablesUser(String processName);


    void updateProcessBasicTables(String processName, String updatedUsers);

    void updateSignOutTimeAndStatusByProcessName(String processName, LocalDateTime now, String 签出);
}